package day_2022_4_to_7.day48;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/07/07 11:55
 **/
public class Day46_2_RecordWrongText {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        Map<String, Integer> map = new LinkedHashMap<>();
        while(in.hasNext()){
            String str = in.next();
            int num = in.nextInt();

            String[] data = str.split("\\\\");
            String a = data[data.length-1];

            if(a.length()>16)  //截取
                a=a.substring(a.length()-16);
            String key=a+" "+num;
            if(map.containsKey(key))
                map.put(key, map.get(key)+1);
            else {
                map.put(key, 1);
            }
        }

        int count = 0;
        for(String str : map.keySet()){
            count++;
            if(count > map.size() - 8){
                System.out.println(str + " " + map.get(str));
            }
        }
    }
}